function convertToStarArray(stars) {
  var num = stars.toString().substring(0, 1);
  var array = [];
  for (var i = 1; i <= 5; i++) {
    if (i <= num) {
      array.push(1);
    } else {
      array.push(0);
    }
  }
  return array;
}

function http(url, callback) {
  wx.request({
    url: url,
    data: {},
    method: "Get",
    header: {
      "content-Type": "application/xml"
    },
    success: function (res) {
      callback(res.data);
    },
    fail: function (error) {
      console.log(error);
    },
    error: function (error) {
      console.log(error);
    }
  })
}
module.exports = {
  convertToStarArray: convertToStarArray,
  http:http
}